package BaseObject.homework;

/**
 * @author Raymond
 * @create 2025/3/13 10:13
 */
public class Homework02 {
    public static void main(String[] args) {
        String[] arr = {"hello", "world"};
        A02 a02 = new A02();
        int str = a02.find(arr, "world");
        System.out.println(str);
    }
}

class A02 {

    public int find(String[] arr, String str) {
        for (int i = 0; i < arr.length; i++) {
            if (str.equals(arr[i])) {
                return i;
            }
        }
        return -1;
    }
}